#include <iostream>
#include <memory>
using namespace std;

template<typename T>
class ArrayDeleter
{
public:
	void operator()(T* ptr)const
	{
		cout<<"call CMyDeleter.operator()"<<endl;
		delete []ptr;
	}
};

void myDeleter(int* ptr) 
{  
  // 自定义删除逻辑  
	cout<<"call myDeleter"<<endl;
	delete ptr;  
}  
int main()
{
	std::unique_ptr<int, decltype(&myDeleter)> ptr1(new int(5), myDeleter);
	std::unique_ptr<int, ArrayDeleter<int>> ptr2(new int[10]);
	std::unique_ptr<int, ArrayDeleter<int>> ptr3(new int[10],ArrayDeleter<int>());
	return 0;
}
